<!DOCTYPE html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="Access-Control-Allow-Origin" content="*">
    <script src="https://how2j.cn/study/js/jquery/2.0.0/jquery.min.js"></script>
    <link href="https://how2j.cn/study/css/bootstrap/3.3.6/bootstrap.min.css" rel="stylesheet">
    <script src="https://how2j.cn/study/js/bootstrap/3.3.6/bootstrap.min.js"></script>
    <script src="https://how2j.cn/study/vue.min.js"></script>
    <script src="https://how2j.cn/study/axios.min.js"></script>
</head>

        <body >
                <div id="div1">
                    <h1>个人求职信息列表</h1>
                    <a href="./add.html" class="btn btn-success">添加</a>
                    <table class="table table-bordered" >
                        <thead>
                        <th>名字</th>
                        <th>行业</th>
                        <th>工作名称</th>
                        <th>工资</th>
                        <th>创建时间</th>
                        <th>有效时间</th>
                        <th>操作</th>
                        </thead>
                        <tbody>
                        <tr v-for="data in list">
                            <td>{{data.name}}</td>
                            <td>{{data.industry}}</td>
                            <td>{{data.productName}}</td>
                            <td>{{data.salary}}</td>
                            <td>{{data.createTime}}</td>
                            <td>{{data.effectiveTime}}</td>
                            <td >
                                <button class="btn btn-danger" @click="deleteById(data.id)">删除</button>
                                <button class="btn btn-danger" @click="update(data.id)">修改</button>
                            </td>
                        </tr>
                        </tbody>
                    </table>

                    <h1>企业招聘信息列表</h1>
                    <table class="table table-bordered">
                        <thead>
                        <th>账号名称</th>
                        <th>企业名称</th>
                        <th>行业</th>
                        <th>工作名称</th>
                        <th>学历</th>
                        <th>工资</th>
                        <th>创建时间</th>
                        <th>有效时间</th>
                        <th>工作详情</th>
                        <th>操作</th>
                        </thead>
                        <tbody>
                        <tr v-for="data in list1">
                            <td>{{data.name}}</td>
                            <td>{{data.companyName}}</td>
                            <td>{{data.industry}}</td>
                            <td>{{data.productName}}</td>
                            <td>{{data.education}}</td>
                            <td>{{data.salary}}</td>
                            <td>{{data.createTime}}</td>
                            <td>{{data.effectiveTime}}</td>
                            <td>{{data.jobDetails}}</td>
                            <td><a class="btn btn-success" @click="findCompanyDetail(data.userId)">查询详情</a></td>
                        </tr>
                        </tbody>
                    </table>

                </div>

        </body>


        <script>

            new Vue({
                el:'#div1',
                data:{
                    list:[],
                    list1:[],
                },
                mounted:function(){ //mounted　表示这个 Vue 对象加载成功了
                    var self = this
                    axios.get("/student/jobList").then(function(response) {
                        self.list= response.data; //此时还是字符串
                    })
                    axios.get("/student/zhaopingList").then(function(response) {
                        self.list1= response.data; //此时还是字符串
                    })
                },
                methods:{
                    deleteById(id){
                        axios.get("/student/deleteJobById?id="+id).then(function(response) {
                            alert("删除成功!");
                            window.location.reload();
                        })
                    },
                    findCompanyDetail(id){
                           window.location.href="company.html?id="+id;
                    },
                    update(id){
                        window.location.href="update.html?id="+id;
                    }
                }
            })

        </script>
</html>
